//
//  NSAttributedString+XYExtension.swift
//  Swift-WB
//
//  Created by lxy on 2017/6/14.
//  Copyright © 2017年 lixiya. All rights reserved.
//

import Foundation
import UIKit

extension NSAttributedString {
    func xy_size(width: CGFloat) -> CGRect {
        let rect = self.boundingRect(with: CGSize(width: width, height: CGFloat.greatestFiniteMagnitude), options: .usesLineFragmentOrigin, context: nil)
        return rect
    }
    
    func xy_height(width: CGFloat) -> CGFloat {
        return self.xy_size(width: width).height
    }
    
    func xy_width() -> CGFloat {
        return self.xy_size(width: CGFloat.greatestFiniteMagnitude).width
    }
    
}
